<?php 
require './configs/config.php';
function mvc_autoload($classname)
{
	if (file_exists("./models/{$classname}.class.php")) {
		require "./models/{$classname}.class.php";
	} elseif(file_exists("./controllers/{$classname}.php")) {
		require "./controllers/{$classname}.php";
	} else {
        header("HTTP/1.0 404not found");
        echo '<h1>来自于入口的404 NOT FOUND</h1>';
        exit;
    }
}
require './libs/Smarty.class.php';
//注册给定的函数作为 __autoload 的实现,固定用法不需要纠结,见手册
spl_autoload_register('mvc_autoload');

$c = (!empty($_GET['c']))?$_GET['c']:'Index';
$a = (!empty($_GET['a']))?$_GET['a']:'index';
$classname = $c.'Controller';
$controller = new $classname();
$controller->$a();








